#include <iostream>

using namespace std;

class Base
{
public:
    Base() { cout << "Base 构造函数\n"; }
    Base(int x) { cout << "Base int带参数构造函数: " << x << "\n"; }
    Base(double x) { cout << "Base double带参数构造函数: " << x << "\n"; }
};
class Derived : public Base
{
public:
    using Base::Base; // 继承 Base 的所有构造函数
    // Derived() : Base() { cout << "Derived 构造函数\n"; }
    // Derived(int x) : Base(x) { cout << "Derived int带参数构造函数: " << x << "\n"; }
};

int main()
{

    cout << "=== 5. 继承构造函数演示 ===\n";
    Derived d1;       // 调用 Derived() 和 Base()
    Derived d2(42);   // 调用 Derived(int) 和 Base(int)
    Derived d3(3.14); // 错误: Derived 没有匹配的构造函数 // 前面写了继承构造函数就可以了

    return 0;
}